#ifndef WEATHER_H
#define WEATHER_H

#include <QWidget>
#include <QMainWindow>
#include "QNetworkAccessManager"
#include "QNetworkReply"
#include "QJsonDocument"
#include "QJsonObject"
#include "QJsonArray"
#include "QStandardItemModel"
#include "QString"
#include "QStandardItemModel"
#include "QList"
#include "QFile"
#include "QMap"
#include <QLabel>
namespace Ui {
class weather;
}

class weather : public QWidget
{
    Q_OBJECT
public:
    explicit weather(QWidget *parent = nullptr);
    ~weather();
    QNetworkAccessManager *manager;
    QStandardItemModel *pModel;

    void analysis(QByteArray byteArray);
    void city_code();
    QList<QString> list_code;
    QList<QString> list_name;

    QString code;
    void updateUI();
public slots:
    void replyFinished(QNetworkReply *reply);
    void on_pushButton_clicked();

public:
    QString low;
    QString high;
    QString ymd;
    QString week;
    QString type;
    QString fengxiang;
    QString fengxiangtype;


    QString city;
    QString shidu;
    QString pm25;
    QString quality;
    QString ganmao;


    QList<QString> list_low;
    QList<QString> list_high;
    QList<QString> list_ymd;
    QList<QString> list_week;
    QList<QString> list_type;
    QList<QString> list_fengxiang;
    QList<QString> list_fengxiangtype;
    QMap<QString,QString>mTypeMap;

    QList<QLabel*>mDateList;
    QList<QLabel*>mDayList;
    QList<QLabel*>mIconList;
    QList<QLabel*>mWeathTypeList;
    QList<QLabel*>mAirList;
    QList<QLabel*>mFengXiangList;
    QList<QLabel*>mFengXiangTypeList;

    void drawTempLineHigh();
    void drawTempLineLow();
    bool eventFilter(QObject *watched, QEvent *event);
private:
    Ui::weather *ui;
};

#endif // WEATHER_H
